//==================================================================
//  Copyright (C) 2006  Davide Pasca
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//==================================================================
///
///
///
///
///
//==================================================================

#ifndef SKYBOX_H
#define SKYBOX_H

#include "m5d.h"

//==================================================================
class SkyBox
{
private:
	M5D::Scene		*_scenep;
	M5D::Mesh		*_skymeshp;
	M5D::Mesh		*_floormeshp;
	M5D::Material	*_skymatep;
	M5D::Material	*_floormatep;

	PMath::Vector3	_sky_base_col;
	PMath::Vector3	_sky_high_col;
	PMath::Vector3	_floor_far_col;
	PMath::Vector3	_floor_near_col;
	PMath::Vector3	_floorslice_far_col;
	PMath::Vector3	_floorslice_near_col;
	int				_floorslice_ang_from;
	int				_floorslice_ang_to;

public:
	SkyBox( M5D::Scene *scenep );
	~SkyBox()
	{
		delete _skymeshp;
		delete _floormeshp;
	}

	//==================================================================
	void SetSkyCols( const PMath::Vector3 &base, const PMath::Vector3 &high )
	{
		_sky_base_col = base;
		_sky_high_col = high;
	}

	//==================================================================
	void SetFloorCols( const PMath::Vector3 &farr, const PMath::Vector3 &nearr )
	{
		_floor_far_col = farr;
		_floor_near_col = nearr;
	}
	//==================================================================
	void SetFloorSliceCols( const PMath::Vector3 &farr, const PMath::Vector3 &nearr, int from_ang, int to_ang )
	{
		_floorslice_far_col = farr;
		_floorslice_near_col = nearr;
		_floorslice_ang_from = from_ang;
		_floorslice_ang_to = to_ang;
	}

	void Rebuild();

	void Update( const PMath::Vector3 &cam_pos );
	void SetBranchVisibility( bool onoff );
};

#endif
